/*
 * @Author: wangdazhuang
 * @Date: 2024-10-15 20:55:01
 * @LastEditTime: 2024-11-02 09:25:39
 * @LastEditors: wangdazhuang
 * @Description: 
 * @FilePath: /pornhub_app/lib/src/views/engagement/controllers/engagement_search_page_controller.dart
 */
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pornhub_app/http/http_service.dart';
import 'package:pornhub_app/model/engagement/engagement_hot_tag_model.dart';

class EngagementSearchPageController extends GetxController {
  RxList<Data> hotTags = <Data>[].obs;
  Rx<EngagementHotTagModel> model = EngagementHotTagModel().obs;

  TextEditingController searchTextController = TextEditingController();

  @override
  void onInit() {
    super.onInit();
    getHotTag();
  }

  Future<void> getHotTag() async {
    try {
      final response = await httpInstance.get(
        url: 'meet/user/hotTag/list',
      );
      if (response != null) {
        var tags = response['data'];
        hotTags.value = tags.map<Data>((tag) => Data.fromJson(tag)).toList();
      }
    } catch (e) {}
  }

  @override
  void dispose() {
    searchTextController.dispose();
    super.dispose();
  }
}
